<TITLE>Drag and Drop</TITLE>
GtkDestDefaults
GtkDragResult
+
<SUBSECTION Destination Side>
gtk_drag_dest_set
gtk_drag_dest_unset
gtk_drag_get_source_widget
gtk_drag_highlight
gtk_drag_unhighlight
+
<SUBSECTION Source Side>
-gtk_drag_begin_with_coordinates
+gtk_drag_begin
gtk_drag_cancel
gtk_drag_set_icon_widget
gtk_drag_set_icon_paintable
targets = gdk_content_formats_new (NULL, 0);
targets = gtk_content_formats_add_text_targets (targets);
- drag = gtk_drag_begin_with_coordinates (widget,
- gtk_gesture_get_device (GTK_GESTURE (gesture)),
- targets, GDK_ACTION_COPY,
- start_x, start_y);
+ drag = gtk_drag_begin (widget,
+ gtk_gesture_get_device (GTK_GESTURE (gesture)),
+ targets, GDK_ACTION_COPY,
+ start_x, start_y);
priv->in_drag = 0;
gdk_content_formats_unref (targets);
}
/**
- * gtk_drag_begin_with_coordinates: (method)
+ * gtk_drag_begin: (method)
* @widget: the source widget
- * @device: (nullable): the device that starts the drag or %NULL to use the default
- * pointer.
- * @targets: The targets (data formats) in which the
- * source can provide the data
+ * @device: (nullable): the device that starts the drag or %NULL to use the default pointer
+ * @targets: The targets (data formats) in which the source can provide the data
* @actions: A bitmask of the allowed drag actions for this drag
- * @x: The initial x coordinate to start dragging from, in the coordinate space
- * of @widget.
- * @y: The initial y coordinate to start dragging from, in the coordinate space
- * of @widget.
+ * @x: The initial x coordinate to start dragging from, in the coordinate space of @widget.
+ * @y: The initial y coordinate to start dragging from, in the coordinate space of @widget.
*
* Initiates a drag on the source side. The function only needs to be used
* when the application is starting drags itself, and is not needed when
* Returns: (transfer none): the context for this drag
*/
GdkDrag *
-gtk_drag_begin_with_coordinates (GtkWidget *widget,
- GdkDevice *device,
- GdkContentFormats *targets,
- GdkDragAction actions,
- gint x,
- gint y)
+gtk_drag_begin (GtkWidget *widget,
+ GdkDevice *device,
+ GdkContentFormats *targets,
+ GdkDragAction actions,
+ gint x,
+ gint y)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (device == NULL || GDK_IS_DEVICE (device), NULL);
/**
* gtk_drag_cancel:
- * @drag: a drag context, as e.g. returned by gtk_drag_begin_with_coordinates()
+ * @drag: a drag context, as e.g. returned by gtk_drag_begin()
*
* Cancels an ongoing drag operation on the source side.
*
* If you want to be able to cancel a drag operation in this way,
* you need to keep a pointer to the drag context, either from an
- * explicit call to gtk_drag_begin_with_coordinates(), or by
- * connecting to #GtkWidget::drag-begin.
+ * explicit call to gtk_drag_begin(), or by connecting to
+ * #GtkWidget::drag-begin.
*
* If @context does not refer to an ongoing drag operation, this
* function does nothing.
/* Source side */
GDK_AVAILABLE_IN_ALL
-GdkDrag *gtk_drag_begin_with_coordinates (GtkWidget *widget,
- GdkDevice *device,
- GdkContentFormats *targets,
- GdkDragAction actions,
- gint x,
- gint y);
+GdkDrag *gtk_drag_begin (GtkWidget *widget,
+ GdkDevice *device,
+ GdkContentFormats *targets,
+ GdkDragAction actions,
+ gint x,
+ gint y);
GDK_AVAILABLE_IN_ALL
void gtk_drag_cancel (GdkDrag *drag);
x, y))
{
icon_info->in_drag = TRUE;
- gtk_drag_begin_with_coordinates (GTK_WIDGET (entry),
- gtk_gesture_get_device (GTK_GESTURE (gesture)),
- icon_info->target_list,
- icon_info->actions,
- start_x, start_y);
+ gtk_drag_begin (GTK_WIDGET (entry),
+ gtk_gesture_get_device (GTK_GESTURE (gesture)),
+ icon_info->target_list,
+ icon_info->actions,
+ start_x, start_y);
}
}
gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
- gtk_drag_begin_with_coordinates (widget,
- gdk_event_get_device ((GdkEvent*) event),
- target_list, actions,
- priv->drag_start_x + ranges[0],
- priv->drag_start_y);
+ gtk_drag_begin (widget,
+ gdk_event_get_device ((GdkEvent*) event),
+ target_list, actions,
+ priv->drag_start_x + ranges[0],
+ priv->drag_start_y);
g_free (ranges);
priv->in_drag = FALSE;
retval = TRUE;
- drag = gtk_drag_begin_with_coordinates (widget,
- device,
- gtk_drag_source_get_target_list (widget),
- icon_view->priv->source_actions,
- icon_view->priv->press_start_x,
- icon_view->priv->press_start_y);
+ drag = gtk_drag_begin (widget,
+ device,
+ gtk_drag_source_get_target_list (widget),
+ icon_view->priv->source_actions,
+ icon_view->priv->press_start_x,
+ icon_view->priv->press_start_y);
set_source_row (drag, model, path);
g_signal_connect (widget, "drag-begin",
G_CALLBACK (drag_begin_cb), NULL);
- gtk_drag_begin_with_coordinates (widget,
- gtk_gesture_get_device (GTK_GESTURE (gesture)),
- target_list,
- GDK_ACTION_COPY,
- info->drag_start_x,
- info->drag_start_y);
+ gtk_drag_begin (widget,
+ gtk_gesture_get_device (GTK_GESTURE (gesture)),
+ target_list,
+ GDK_ACTION_COPY,
+ info->drag_start_x,
+ info->drag_start_y);
info->in_drag = FALSE;
{
priv->detached_tab = priv->cur_page;
- gtk_drag_begin_with_coordinates (widget,
- gtk_get_current_event_device (),
- priv->source_targets, GDK_ACTION_MOVE,
- priv->drag_begin_x, priv->drag_begin_y);
+ gtk_drag_begin (widget,
+ gtk_get_current_event_device (),
+ priv->source_targets, GDK_ACTION_MOVE,
+ priv->drag_begin_x, priv->drag_begin_y);
return;
}
sidebar->dragging_over = TRUE;
- gtk_drag_begin_with_coordinates (GTK_WIDGET (sidebar),
- gtk_gesture_get_device (GTK_GESTURE (gesture)),
- sidebar->source_targets, GDK_ACTION_MOVE,
- drag_x, drag_y);
+ gtk_drag_begin (GTK_WIDGET (sidebar),
+ gtk_gesture_get_device (GTK_GESTURE (gesture)),
+ sidebar->source_targets, GDK_ACTION_MOVE,
+ drag_x, drag_y);
}
g_object_unref (sidebar);
g_signal_connect (text_view, "drag-begin",
G_CALLBACK (drag_begin_cb), NULL);
- gtk_drag_begin_with_coordinates (GTK_WIDGET (text_view),
- gdk_event_get_device (event),
- formats,
- GDK_ACTION_COPY | GDK_ACTION_MOVE,
- x, y);
+ gtk_drag_begin (GTK_WIDGET (text_view),
+ gdk_event_get_device (event),
+ formats,
+ GDK_ACTION_COPY | GDK_ACTION_MOVE,
+ x, y);
}
static void
gtk_gesture_set_state (GTK_GESTURE (tree_view->priv->drag_gesture),
GTK_EVENT_SEQUENCE_CLAIMED);
- drag = gtk_drag_begin_with_coordinates (widget,
- gtk_gesture_get_device (GTK_GESTURE (tree_view->priv->drag_gesture)),
- gtk_drag_source_get_target_list (widget),
- di->source_actions,
- start_x, start_y);
+ drag = gtk_drag_begin (widget,
+ gtk_gesture_get_device (GTK_GESTURE (tree_view->priv->drag_gesture)),
+ gtk_drag_source_get_target_list (widget),
+ di->source_actions,
+ start_x, start_y);
set_source_row (drag, model, path);